/*
 * @Author: EyeSklear 1814580085@qq.com
 * @Date: 2024-01-13 14:56:58
 * @LastEditors: LIFM0623 1944099171@qq.com
 * @LastEditTime: 2024-03-29 20:41:36
 * @FilePath: \Scene_Back\src\imageraster\imageraster.controller.ts
 * @Description:
 *
 * Copyright (c) 2024 by EyeSklear , All Rights Reserved.
 */
import {
  Controller,
  Get,
  Post,
  Body,
  Patch,
  Param,
  Delete,
  Req,
} from '@nestjs/common';
import { ImagerasterService } from './imageraster.service';
import {
  RawImagerasterDto,
} from './dto/create-imageraster.dto';
import { Request } from 'express';
import { UpdateImagerasterDto } from './dto/update-imageraster.dto';
import { Public } from 'src/common/decorator/public.decorator';

@Controller('imageRaster')
export class ImagerasterController {
  constructor(private readonly imagerasterService: ImagerasterService) { }

  @Post('createImageRasterItem')
  async create(@Body() rawImagerasterDto: RawImagerasterDto, @Req() request: Request,) {
    const user = request.user;
    rawImagerasterDto.creator = (user as any).email;
    return this.imagerasterService.create(rawImagerasterDto);
    
  }

  @Get('findAll')
  findAll() {
    return this.imagerasterService.findAll();
  }

  @Get('findOne/:id')
  findOne(@Param('id') id: string) {
    return this.imagerasterService.findOne(id);
  }

  @Patch('update/:id')
  update(
    @Param('id') id: string,
    @Body() updateImagerasterDto: UpdateImagerasterDto,
  ) {
    return this.imagerasterService.update(id, updateImagerasterDto);
  }

  @Delete('remove/:id')
  remove(@Param('id') id: string) {
    return this.imagerasterService.remove(id);
  }

  @Public()
  @Get('getImageRasterbbox/:id')
  getImageRasterbbox(@Param('id') id: string){
    return this.imagerasterService.getImageRasterbbox(id);
  }

  @Public()
  @Get('getPubilcImageRasterbbox/:id')
  getPubilcImageRasterbbox(@Param('id') id: string){
    return this.imagerasterService.getPubilcImageRasterbbox(id);
  }
}
